ExamPlay Light Logo
Đăng nhập

Computer Science for IGCSE & O level - Programming (Section 3 - No. 16)

What is the main difference between a local and a global variable?
Local variables can be used anywhere in the program, and global variables can only be used in a single function.
Global variables are only for numbers, and local variables are for text.
Local variables are declared inside a function, and global variables are declared outside any function.
Local variables are more efficient than global variables.

Giải thích

The key difference is their scope - where they can be accessed in the code.

Bình luận (0)

Đăng nhập để bình luận
Quảng cáo
BrainBehindX Inc Logo
©2026; Được cung cấp bởi BrainBehindX Inc